home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / LP_M68K.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  4KB  |  136 lines

  1. #ifndef _LINUX_LP_H
  2. #define _LINUX_LP_H
  3.  
  4. /*
  5.  * split in two parts by Joerg Dorchain
  6.  * usr/include/linux/lp.h  modified for Amiga by Michael Rausch
  7.  * modified for Atari by Andreas Schwab
  8.  * bug fixed by Jes Sorensen 18/8-94:
  9.  *     It was not possible to compile the kernel only for Atari or Amiga.
  10.  *
  11.  * linux i386 version  c.1991-1992 James Wiegand
  12.  * many modifications copyright (C) 1992 Michael K. Johnson
  13.  * Interrupt support added 1993 Nigel Gamble
  14.  */
  15.  
  16. /*
  17.  *  many many printers are we going to support? currently, this is the
  18.  *  hardcoded limit
  19.  */
  20. #define MAX_LP 5
  21.  
  22. /*
  23.  * Per POSIX guidelines, this module reserves the LP and lp prefixes
  24.  * These are the lp_table[minor].flags flags...
  25.  */
  26. #define LP_EXIST 0x0001
  27. #define LP_BUSY     0x0004
  28. #define LP_ABORT 0x0040
  29. #define LP_CAREFUL 0x0080
  30. #define LP_ABORTOPEN 0x0100
  31.  
  32. /* timeout for each character.  This is relative to bus cycles -- it
  33.  * is the count in a busy loop.  THIS IS THE VALUE TO CHANGE if you
  34.  * have extremely slow printing, or if the machine seems to slow down
  35.  * a lot when you print.  If you have slow printing, increase this
  36.  * number and recompile, and if your system gets bogged down, decrease
  37.  * this number.  This can be changed with the tunelp(8) command as well.
  38.  */
  39.  
  40. #define LP_INIT_CHAR 1000
  41.  
  42. /* The parallel port specs apparently say that there needs to be
  43.  * a .5usec wait before and after the strobe.  Since there are wildly
  44.  * different computers running linux, I can't come up with a perfect
  45.  * value, but since it worked well on most printers before without,
  46.  * I'll initialize it to 0.
  47.  */
  48.  
  49. #define LP_INIT_WAIT 0
  50.  
  51. /* This is the amount of time that the driver waits for the printer to
  52.  * catch up when the printer's buffer appears to be filled.  If you
  53.  * want to tune this and have a fast printer (i.e. HPIIIP), decrease
  54.  * this number, and if you have a slow printer, increase this number.
  55.  * This is in hundredths of a second, the default 2 being .05 second.
  56.  * Or use the tunelp(8) command, which is especially nice if you want
  57.  * change back and forth between character and graphics printing, which
  58.  * are wildly different...
  59.  */
  60.  
  61. #define LP_INIT_TIME 40
  62.  
  63. /* IOCTL numbers */
  64. #define LPCHAR   0x0601  /* corresponds to LP_INIT_CHAR */
  65. #define LPTIME   0x0602  /* corresponds to LP_INIT_TIME */
  66. #define LPABORT  0x0604  /* call with TRUE arg to abort on error,
  67.                 FALSE to retry.  Default is retry.  */
  68. #define LPSETIRQ 0x0605  /* call with new IRQ number,
  69.                 or 0 for polling (no IRQ) */
  70. #define LPGETIRQ 0x0606  /* get the current IRQ number */
  71. #define LPWAIT   0x0608  /* corresponds to LP_INIT_WAIT */
  72. #define LPCAREFUL   0x0609  /* call with TRUE arg to require out-of-paper, off-
  73.                 line, and error indicators good on all writes,
  74.                 FALSE to ignore them.  Default is ignore. */
  75. #define LPABORTOPEN 0x060a  /* call with TRUE arg to abort open() on error,
  76.                 FALSE to ignore error.  Default is ignore.  */
  77. #define LPGETSTATUS 0x060b  /* return LP_S(minor) */
  78. #define LPRESET     0x060c  /* reset printer */
  79.  
  80. /* timeout for printk'ing a timeout, in jiffies (100ths of a second).
  81.    This is also used for re-checking error conditions if LP_ABORT is
  82.    not set.  This is the default behavior. */
  83.  
  84. #define LP_TIMEOUT_INTERRUPT    (60 * HZ)
  85. #define LP_TIMEOUT_POLLED    (10 * HZ)
  86.  
  87.  
  88. #define LP_BUFFER_SIZE 1024 /*256*/
  89.  
  90. enum lp_type  {
  91. LP_UNKNOWN = 0,
  92. LP_AMIGA = 1,
  93. LP_ATARI = 2,
  94. LP_MFC = 3,
  95. LP_IOEXT = 4,
  96. LP_MVME167 = 5,
  97. LP_BVME6000 = 6
  98. };
  99.  
  100. /*
  101.  * warning: this structure is in kernel space and has to fit in one page,
  102.  * i.e. must not be larger than 4k
  103.  */
  104. struct lp_struct {
  105.     char *name;
  106.     unsigned int irq;
  107.     void (*lp_out)(int,int);    /*output char function*/
  108.     int (*lp_is_busy)(int);
  109.     int (*lp_has_pout)(int);
  110.     int (*lp_is_online)(int);
  111.     int (*lp_dummy)(int);
  112.     int (*lp_ioctl)(int, unsigned int, unsigned long);
  113.     int (*lp_open)(int);        /* for module use counter */
  114.     void (*lp_release)(int);    /* for module use counter */
  115.     int flags;        /*for BUSY... */
  116.     unsigned int chars;    /*busy timeout */
  117.     unsigned int time;    /*wait time */
  118.     unsigned int wait;
  119.     struct wait_queue *lp_wait_q; /*strobe wait */
  120.     void *base;            /* hardware drivers internal use*/
  121.     enum lp_type type;
  122.     char lp_buffer[LP_BUFFER_SIZE];
  123.     int do_print;
  124.     unsigned long copy_size,bytes_written;
  125. };
  126.  
  127. extern struct lp_struct *lp_table[MAX_LP];
  128. extern unsigned int lp_irq;
  129.  
  130. void lp_interrupt(int dev);
  131. int lp_m68k_init(void);
  132. int register_parallel(struct lp_struct *, int);
  133. void unregister_parallel(int);
  134.  
  135. #endif
  136.